package com.hhss.qishi.controller.sys;

import com.hhss.qishi.controller.CommonController;
import com.hhss.qishi.entity.system.Permission;
import com.hhss.qishi.service.system.PermissionService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

/**
 * 权限控制器
 */
@RestController
@RequestMapping("permissions")
public class PermissionController extends CommonController<Permission> {

	@Autowired
	private PermissionService permissionService;

	@RequestMapping(value = "/", method = RequestMethod.POST)
	public int add(Permission permission) {
		return permissionService.add(permission);
	}

	@RequestMapping(value = "/{id}", method = RequestMethod.GET)
	public Permission getById(@PathVariable Long id) {
		return permissionService.getById(id);
	}

	@RequestMapping(value = "/", method = RequestMethod.PUT)
	public int update(Permission permission) {
		return permissionService.updateById(permission);
	}

	@RequestMapping(value = "/{id}", method = RequestMethod.DELETE)
	public int deleteById(@PathVariable Long id) {
		return permissionService.deleteById(id);
	}

}
